<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$appConfigs.title}</title>

    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/{$page_theme | default: 'default'}/easyui.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/style/my.css">
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/javascript/my.js"></script>
    
</head> 
<body onpageshow="pageReady()">
    {datagrid id="dg" view="i_strategy.view"}
    
    <script>
    {literal}
    field_formatters.effective_from=function (value, row, index){
		if(value)
			return value.substring(0,10);
    }
    field_formatters.effective_to=function (value, row, index){
		if(value)
			return value.substring(0,10);
    }
    field_formatters.scope=function (value, row, index){
		if(value == 0)
			return '共有策略';
		else if(value == 1)
			return '私有策略';
    }
    field_formatters.status=function (value, row, index){
		if(value == 0)
			return '<font color="red">暂停</font>';
		else if(value == 1)
			return '<font color="green">执行中</font>';
		else if(value == 2)
			return '<font color="red">已结束</font>';
		else if(value == 3)
			return '<font color="green">执行中（仅卖出）</font>';
    }
    
    function showStrategies() {
	    var row = getDatagrid('dg').datagrid('getSelected');
	    if(row) {
	    	window.parent.openTab(row.name + '的策略','/invest/invest/strategy.shtml?invest_id='+row.invest_id);
	    } else {
			alert('没有选择投资项目！');
	    }
    }
    function executeAllStrategies() {
	    postByAjax("/invest/StrategyService/executeAllStrategies.do",null,reload)
    }
    function pageReady() {
      resetPagination('dg');
      $('#dg').datagrid('options').url='/invest/StrategyService/findAll.do';
      $("#status").textbox('setValue',1);
      queryData('dg');
    }
    {/literal}
    </script>
</body>
</html>